package model;

import model.interfaces.DicePair;
import model.interfaces.GameEngine;

/**
 * Created by heyuxun on 2018/4/11.
 */
public class DicePairImpl implements DicePair {
    int dice1=0;
    int dice2=0;
    int numFaces= GameEngine.NUM_FACES;
    public DicePairImpl(int dice1, int dice2, int numFaces){
        this.dice1=dice1;
        this.dice2=dice2;
        this.numFaces=numFaces;
    }

    @Override
    public int getDice1() {
        dice1= (int) (Math.random() * numFaces) +1;//random generate 1-6
        return dice1;
    }

    @Override
    public int getDice2() {
        dice2= (int) (Math.random() * numFaces) +1;//random generate 1-6
        return dice2;
    }

    @Override
    public int getNumFaces() {
        return dice1+dice2;
    }// final dices num

    @Override
    public String toString() {
        return String.format("Dice 1:%d, Dice 2:%d.. Total:%d",dice1,dice2,dice1+dice2);
    }//logging format
}
